<template>
  <div class="info-key-cmd-root info-root">
    <div class="info-title">
      键与命令
    </div>
    <div class="info-content">
      <el-descriptions class="qa-gw-desc" :column="2">
        <el-descriptions-item label="已执行命令数:">
          <el-tag type="info">{{ redisInfo.total_commands_processed }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="每秒执行命令:">
          <el-tag type="info">{{ redisInfo.instantaneous_ops_per_sec }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="过期自动删除:">
          <el-tag type="info">{{ redisInfo.expired_keys }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="容量限制驱逐:">
          <el-tag type="info">{{ redisInfo.evicted_keys }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="被订阅频道数:">
          <el-tag type="info">{{ redisInfo.pubsub_channels }}</el-tag>
        </el-descriptions-item>
      </el-descriptions>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

const redisInfo = ref({
  total_commands_processed: "",
  pubsub_channels: "",
  instantaneous_ops_per_sec: "",
  expired_keys: "",
  uptime_in_days: "",
  evicted_keys: "",
  connected_clients: "",
})

const initMap = (info: any) => {
  redisInfo.value = info;
}

defineExpose({
  initMap
})
</script>

<style scoped lang="scss">
.info-key-cmd-root {
  @include box(100%, 100%);

  .info-title {
    @include themeColor(#AE564C, #aa4d45)
  }
}
</style>